<%@ include file="/WEB-INF/views/taglib.jsp" %>
<script type="text/javascript">

var tb_pathToImage = "<spring:url value="/resources/images/loadingAnimation.gif" />";

var globalSections = eval('${globalSectionJSON}');
var globalRoles = eval('${globalRoleJSON}');
var globalJsCalDateFormat = "%Y-%m-%d";
var globalJsCalMonthFormat = "%Y-%m";
var globalJsCalDateWithHourMinuteFormat = "%Y-%m-%d %H:%M";

var globalAssetModel;
var globalAssetModelEquipment;
var globalAssetModelComponent;
</script>
<script type="text/javascript" src="<spring:url value="/resources/js/common.js" />"></script>
<script type="text/javascript" src="<spring:url value="/resources/js/jquery-1.4.4.min.js" />"></script>
<script type="text/javascript" src="<spring:url value="/resources/js/json.min.js" />"></script>
<script type="text/javascript" src="<spring:url value="/resources/js/jquery-ui-1.8.9.custom.min.js" />"></script>
<script type="text/javascript" src="<spring:url value="/resources/js/jquery.hoverIntent.minified.js" />"></script>
<script type="text/javascript" src="<spring:url value="/resources/js/jscal/jscal2.js" />"></script>
<script type="text/javascript" src="<spring:url value="/resources/js/jscal/en.js" />"></script>
<script type="text/javascript" src="<spring:url value="/resources/js/jquery.numeric.js" />"></script>

<script type="text/javascript" src="<spring:url value="/resources/js/ajaxupload.js" />"></script>
<script type="text/javascript" src="<spring:url value="/resources/js/jquery.autocomplete.js" />"></script>
<script type="text/javascript" src="<spring:url value="/resources/js/jquery.ajaxQueue.js" />"></script>
<script type="text/javascript" src="<spring:url value="/resources/js/jquery.bgiframe.min.js" />"></script>
<script type="text/javascript" src="<spring:url value="/resources/js/thickbox-compressed.js" />"></script>

<link type="text/css" href="<spring:url value="/resources/styles/jquery-ui/flick/jquery-ui-1.8.9.custom.css" />" rel="stylesheet" />	
<link rel="stylesheet" href="<spring:url value="/resources/styles/blueprint/screen.css" />" type="text/css" media="screen, projection" />
<link rel="stylesheet" href="<spring:url value="/resources/styles/blueprint/print.css" />"  type="text/css" media="print" />
<link rel="stylesheet" href="<spring:url value="/resources/styles/blueprint/plugins/buttons/screen.css" />"  type="text/css" media="screen, projection"  />
<link rel="stylesheet" href="<spring:url value="/resources/styles/blueprint/plugins/link-icons/screen.css" />"  type="text/css" media="screen, projection"  />
<link rel="stylesheet" href="<spring:url value="/resources/styles/jscal/jscal2.css" />"  type="text/css" media="screen, projection"  />
<link rel="stylesheet" href="<spring:url value="/resources/styles/jscal/border-radius.css" />"  type="text/css" media="screen, projection"  />
<link rel="stylesheet" href="<spring:url value="/resources/styles/jscal/reduce-spacing.css" />"  type="text/css" media="screen, projection"  />
<link rel="stylesheet" href="<spring:url value="/resources/styles/common.css" />"  type="text/css" media="screen, projection"  />
<link rel="stylesheet" href="<spring:url value="/resources/styles/CD-basic.css" />"  type="text/css" media="screen, projection"  />
<link rel="stylesheet" href="<spring:url value="/resources/styles/menu.css" />"  type="text/css" media="screen, projection"  />
<link rel="stylesheet" href="<spring:url value="/resources/styles/fileuploader.css" />"  type="text/css" media="screen, projection"  />
<link rel="stylesheet" href="<spring:url value="/resources/styles/jquery.autocomplete.css" />"  type="text/css" media="screen, projection"  />

<spring:url value="/resources/styles/blueprint/" var="blueprintUrl"></spring:url>
<spring:url value="/resources/images" var="imageUrl" scope="application"></spring:url>

<!--[if (gte IE 6)&(lte IE 8)]>
  <script type="text/javascript" src="<spring:url value="/resources/js/selectivizr.js" />"></script>
<![endif]-->

<!--[if lt IE 8]>
  <link rel="stylesheet" href="<spring:url value="/resources/styles/blueprint/ie.css" />" type="text/css" media="screen, projection" />
<![endif]-->

<!--[if IE 7.0]> 
  <link rel="stylesheet" href="<spring:url value="/resources/styles/ie7.css" />"  type="text/css" media="screen, projection"  />
<![endif]-->

    
  

	
<!--[if lt IE 7]> 
    <script type="text/javascript" src="<spring:url value="/resources/js/DD_belatedPNG_0.0.8a-min.jS" />"></script>
    <script> 
	DD_belatedPNG.fix('.CD_HeaderFloatRight, #homeLogo img, .button img, .CD_Actions img, .CD_addNew img');    
    </script> 
    <link rel="stylesheet" href="<spring:url value="/resources/styles/ie6.css" />"  type="text/css" media="screen, projection"  /> 
<![endif]-->



<div id="disableDialog" title="Confirmation" style="display: none">
	<p>Are you sure you want to disable record ?</p>
</div>

<div id="errorDialog" title="Error" style="display: none">
	<p>There is an error during request</p>
</div>

<div id="waitLoginDialog" title="Please Wait" style="display: none">
	<p>Please wait while authentication is taking in process</p>
</div>

<div id="waitCommonDialog" title="Please Wait" style="display: none">
	<p>Please wait while populating page is in process <img src="${imageUrl}/loadingAnimation.gif"></p>
</div>

<div id="progressbar"></div>

<script type="text/javascript">

	function formatDate(obj)
	{
		if(obj==null) return "";
		var curMonth = obj.getMonth();
		curMonth++;
		if(curMonth<10)
			curMonth="0"+curMonth;
		return obj.getFullYear()+"-"+curMonth+"-"+obj.getDate()+" "+obj.getHours()+":"+obj.getMinutes();
	}

	function confirmDisable(url)
	{
		$("#disableDialog").dialog({buttons : {
			"Disable" : function() {
				location.href=url;
			}
		}});
		
		$("#disableDialog").dialog('open');
	}
	
	

	function autoCompleteAssetModel()
	{
		$(".assetModelName").autocomplete(globalAssetModel, {
	        dataType: 'json',
	        highlight: false,
	        scroll: true,
	        scrollHeight: 300,
	        autoFill: true,
			mustMatch: true,
	        parse: function(data) {
                var array = new Array();
                for(var i=0;i<data.length;i++)
                {
                    array[i] = { data: data[i], value: data[i].assetModelId, result: data[i].assetModelName };
                }
                return array;
	        },

	        formatItem: function(row) {
	        	
	             return row.assetModelName;
	        }
	    });
		
		$(".assetModelName").result(autoCompleteAssetModelHandler);  
	}
	
	function autoCompleteAssetModelEquipment()
	{
		$(".assetEquipmentCode").autocomplete(globalAssetModelEquipment, {
	        dataType: 'json',
	        highlight: false,
	        scroll: true,
	        scrollHeight: 300,
	        autoFill: true,
			mustMatch: true,
	        parse: function(data) {
                var array = new Array();
                for(var i=0;i<data.length;i++)
                {
                    array[i] = { data: data[i], value: data[i].assetModelId, result: data[i].assetModelCode };
                }
                return array;
	        },

	        formatItem: function(row) {
	        	
	             return row.assetModelCode;
	        }
	    });
		
		$(".assetEquipmentCode").result(autoCompleteAssetModelEquipmentHandler);  
	}
	
	$(document).ready(function() {
		

		$("#disableDialog").dialog({
			height : 150,
			width : 340,
			modal : true,
			autoOpen : false
		});
		
		$("#errorDialog").dialog({
			height : 150,
			width : 340,
			modal : true,
			autoOpen : false
		});
		
		$("#waitLoginDialog").dialog({
			height : 100,
			width : 300,
			resizable: false,
			modal : true,
			autoOpen : false
		});
		
		$("#waitCommonDialog").dialog({
			height : 100,
			width : 350,
			resizable: false,
			modal : true,
			autoOpen : false
		});
		
		
		
		$("#errorDialog").ajaxError(function(event, request, settings) {
			
			aaarquest =request;
			aaaevent =event;
			//$(this).html("Error requesting page " + settings.url + "!");
			//$("#errorDialog").dialog('open');
		});
		
	});
	
</script>

